/*
** list.h for zappy in /home/druart_p/Work/projet/zappy/zappy-2015-2014s-renard_g/serv-src
**
** Made by pierrick druart
** Login   <druart_p@epitech.net>
**
** Started on  Tue Jul 10 15:35:13 2012 pierrick druart
** Last update Tue Jul 10 15:58:47 2012 pierrick druart
*/

#ifndef		_LIST_H
#define		_LIST_H

#include	"item.h"

typedef struct	s_list
{
  int		len;

  struct s_item	*head;
  struct s_item	*tail;

  void		(*add_front)(struct s_list *, void *);
  void		(*add_back)(struct s_list *, void *);
  int		(*find)(struct s_list *, int (*f)(void *, void *), void *);
  void		(*pop)(struct s_list *, void (*f)(void *));
  void		(*clear)(struct s_list *, void (*f)(void *));
  void		(*foreach)(struct s_list *, void (*f)(void *, void *), void *);
  struct s_item	*(*erase)(struct s_list *, struct s_item *,
      void (*f)(void *));
}		t_list;

struct s_list	*new_list();

void		list_pop(struct s_list *this, void (*func)(void *));
void		list_for_each(struct s_list *this, void (*f)(void *, void *),
    void *);
struct s_item	*list_erase(struct s_list *this, struct s_item *item,
    void (*f)(void *));

#endif		/* _LIST_H */
